//
//  LocationManager.h
//  Tool
//
//  Created by 周小宏 on 16/9/10.
//  Copyright © 2016年 周小宏. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <AMapFoundationKit/AMapFoundationKit.h>
#import <AMapLocationKit/AMapLocationKit.h>
#import <AMapSearchKit/AMapSearchKit.h>

@protocol LocationManagerDelegate <NSObject>

- (void)RouteSearchDoneResponse:(AMapRouteSearchResponse *)response;

@end

typedef void(^completionBlock)(CLLocation *location, AMapLocationReGeocode *regeodic, NSError *error);
typedef void(^ReGeoBlock)(AMapReGeocode *reGeocode, NSError *error);
typedef void(^GeoBlock)(AMapGeocodeSearchResponse *response, NSError *error);
typedef void(^POIArr)(NSMutableArray *POIArr);
typedef void(^DistrictBlock)(AMapDistrictSearchResponse *response, NSError *error);

@interface LocationManager : AMapLocationManager

@property (nonatomic, copy) POIArr POIArr;
@property (nonatomic, copy) ReGeoBlock reGeocode;
@property (nonatomic, copy) GeoBlock geocode;
@property (nonatomic, copy) DistrictBlock districtBlock;
@property (nonatomic, weak) id<LocationManagerDelegate> locationDelegate;

+ (instancetype)sharedManager;

/**
 *  判断用户是否允许定位
 *
 *  @return Bool
 */
- (BOOL)isEnabledLocationServices;
/**
 *  获取单次定位与地址
 *
 */
- (void)getOnceLocationWithReGeocode:(completionBlock)block;

/**
 *  附近热词POI搜索
 *
 *  @param keyWord  关键词
 *  @param location 当前位置
 */
- (void)searchPOIWithKeyWord:(NSString *)keyWord andCurrentLocation:(CLLocation *)location;


/**
 多边形查询POI热词

 @param keyWord 关键词
 @param polygon AMapGeoPolygon类型多边形
 */
- (void)searchPOIWithKeyWord:(NSString *)keyWord andAMapPolygon:(AMapGeoPolygon *)polygon;

/**
 *  获取城市POI信息
 *
 *  @param city    城市名
 *  @param keyword 关键字
 */
- (void)searchPOIWithCity:(NSString *)city andKeyword:(NSString *)keyword;
/**
 *  获取当前位置的ReGeocode  需要实现此类reGeocode Block
 */
- (void)getCurrentLocationReGeocode;

/**
 *  获取某个地址的geo编码信息 需要实现此类geocode Block
 *
 *  @param address 地址字符串
 */
- (void)getGeocodeWithAddress:(NSString *)address;

/**
 获取高德路径规划

 @param origin      起始位置
 @param destination 终点位置
 */
- (void)getPathPlanningWithOrigin:(CLLocationCoordinate2D)origin destination:(CLLocationCoordinate2D)destination;

/**
 获取行政区域

 @param keywords 获取子行政区keywords
 */
- (void)getDistrictWithKeywords:(NSString *)keywords;
@end
